home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / konq_filetip.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.8 KB  |  98 lines

  1. /* This file is part of the KDE projects
  2.    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
  3.    Copyright (C) 2000, 2001, 2002 David Faure <david@mandrakesoft.com>
  4.    Copyright (C) 2004 Martin Koller <m.koller@surfeu.at>
  5.  
  6.    This program is free software; you can redistribute it and/or
  7.    modify it under the terms of the GNU General Public
  8.    License as published by the Free Software Foundation; either
  9.    version 2 of the License, or (at your option) any later version.
  10.  
  11.    This program is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.    General Public License for more details.
  15.  
  16.    You should have received a copy of the GNU General Public License
  17.    along with this program; see the file COPYING.  If not, write to
  18.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.    Boston, MA 02110-1301, USA.
  20. */
  21.  
  22. #ifndef KONQ_FILETIP_H
  23. #define KONQ_FILETIP_H
  24.  
  25. #include <qframe.h>
  26. #include <qpixmap.h>
  27. #include <kio/previewjob.h>
  28.  
  29. #include <libkonq_export.h>
  30.  
  31. class KFileItem;
  32. class QLabel;
  33. class QScrollView;
  34. class QTimer;
  35.  
  36. //--------------------------------------------------------------------------------
  37.  
  38. class LIBKONQ_EXPORT KonqFileTip : public QFrame
  39. {
  40.   Q_OBJECT
  41.  
  42.   public:
  43.     KonqFileTip( QScrollView *parent );
  44.     ~KonqFileTip();
  45.  
  46.     void setPreview(bool on);
  47.  
  48.     /**
  49.       @param on show tooltip at all
  50.       @param preview include file preview in tooltip
  51.       @param num the number of tooltip texts to get from KFileItem
  52.       */
  53.     void setOptions( bool on, bool preview, int num );
  54.  
  55.     /** Set the item from which to get the tip information
  56.       @param item the item from which to get the tip information
  57.       @param rect the rectangle around which the tip will be shown
  58.       @param pixmap the pixmap to be shown. If 0, no pixmap is shown
  59.       */
  60.     void setItem( KFileItem *item, const QRect &rect = QRect(),
  61.                   const QPixmap *pixmap = 0 );
  62.  
  63.     virtual bool eventFilter( QObject *, QEvent *e );
  64.  
  65.   protected:
  66.     virtual void drawContents( QPainter *p );
  67.     virtual void resizeEvent( QResizeEvent * );
  68.  
  69.   private slots:
  70.     void gotPreview( const KFileItem*, const QPixmap& );
  71.     void gotPreviewResult();
  72.  
  73.     void startDelayed();
  74.     void showTip();
  75.     void hideTip();
  76.  
  77.   private:
  78.     void setFilter( bool enable );
  79.  
  80.     void reposition();
  81.  
  82.     QLabel*    m_iconLabel;
  83.     QLabel*    m_textLabel;
  84.     bool       m_on : 1;
  85.     bool       m_preview : 1;  // shall the preview icon be shown
  86.     bool       m_filter : 1;
  87.     QPixmap    m_corners[4];
  88.     int        m_corner;
  89.     int        m_num;
  90.     QScrollView* m_view;
  91.     KFileItem* m_item;
  92.     KIO::PreviewJob* m_previewJob;
  93.     QRect      m_rect;
  94.     QTimer*    m_timer;
  95. };
  96.  
  97. #endif
  98.